using System;
using FytSoa.Common.Utils;
using System.ComponentModel.DataAnnotations;
using FytSoa.Application.Hr;
using FytSoa.Domain.Erp;
using SqlSugar;

namespace FytSoa.Application.Erp;

/// <summary>
/// erp-生产订单工艺路线关系表
/// </summary>
public class ErpProduceOrderCraftDto : AppEntity
{
    /// <summary>
    /// 顺序编号
    /// </summary>
    public int Number { get; set; } = 0;
    
    /// <summary>
    /// 批次号
    /// </summary>
    public string BatchNumber { get; set; }

    /// <summary>
    /// 订单编号
    /// </summary>
    public long OrderId { get; set; }
    
    /// <summary>
    /// 生成订单
    /// </summary>
    public ErpProduceOrderDto Order { get; set; }

    /// <summary>
    /// 工艺路线编号
    /// </summary>
    [Required]
    public long CraftId { get; set; }
    
    /// <summary>
    /// 工艺路线
    /// </summary>
    public ErpProduceCraftSimpleDto Craft { get; set; }
    
    /// <summary>
    /// 工艺路线归属产品
    /// </summary>
    [Required]
    public long ProductId { get; set; } = 0;
    
    /// <summary>
    /// 产品
    /// </summary>
    public ErpProductSimpleDto Product { get; set; }

    /// <summary>
    /// 负责人编号
    /// </summary>
    [Required]
    public long PersonId { get; set; }
    
    /// <summary>
    /// 负责人
    /// </summary>
    public HrEmployeeSimpleDto Employee { get; set; }

    /// <summary>
    /// 预计完成时间
    /// </summary>
    [Required]
    public DateTime PlanCompleteTime { get; set; }

    /// <summary>
    /// 状态0待接/1接受/2开工3/完成
    /// </summary>
    [Required]
    public int Status { get; set; } = 0;
    
    /// <summary>
    /// 是否驳回
    /// </summary>
    public bool IsReject { get; set; } = false;

    /// <summary>
    /// 工时
    /// </summary>
    public double WorkHour { get; set; } = 0;

    /// <summary>
    /// 状态进度
    /// </summary>
    public List<ErpProduceOrder.DesignProcessModel.ProcessModel> StatusProcess { get; set; } = new();

    /// <summary>
    /// 备注信息
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 要插入到哪个流程的后面
    /// </summary>
    public long AfterId { get; set; } = 0;
}